﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SalesModel;

namespace SalesController.ClassesDB
{
    public class SalesDB
    {
        DAOFactory daoFactory = null;
        DAOSale daoSales = null;

         public SalesDB()
        {
            daoFactory = DAOFactory.getDAOFactory(DBConnection.dbType);
            daoSales = daoFactory.getDAOSales(); //Polimorfismo
        }
         public List<Sale> Values
         {
             get { return daoSales.queryAll(); }
         }
         public void Add(Sale s)
         {
             //productList.Add(p);
             daoSales.add(s);
         }
         public int Size
         {
             get { return daoSales.count(); }
         }
         public void Delete(int i)
         {
             //productList.RemoveAt(i);
             daoSales.delete(i);
         }
         public void Update(Sale s)
         {
             daoSales.update(s);
         }
         public Sale QueryById(int salesId)
         {
             return daoSales.queryById(salesId);
         }
    }
}
